/*
 * @(#)WhereClear.java    0.2 04/01/2009
 */
package org.miao.catstorage;

import java.util.regex.Pattern;

/**
 * Where清理器
 * <p>该清理器用于清理语句中作废的Where关键字</p>
 * @author Miao
 * @version 0.2
 * @since 0.2
 */
public class WhereClear implements Clear {

    /**
     * 清理作废where关键字的正则表达式
     */
    private Pattern whereRegex = Pattern.compile("where\\s+(group|order|$)", Pattern.CASE_INSENSITIVE);

    public String clear(String statement) {
        return whereRegex.matcher(statement).replaceAll(" $1");
    }
}
